#!/usr/bin/python

from Crypto.Cipher import AES
from string import printable
from hashlib import md5

ct = 'ef92fab38516aa95fdc53c2eb7e8fe1d5e12288fdc9d026e30469f38ca87c305ef92fab38516aa95fdc53c2eb7e8fe1d5e12288fdc9d026e30469f38ca87c305'
enc_flag = 'fa364f11360cef2550bd9426948af22919f8bdf4903ee561ba3d9b9c7daba4e759268b5b5b4ea2589af3cf4abe6f9ae7e33c84e73a9c1630a25752ad2a984abfbbfaca24f7c0b4313e87e396f2bf5ae56ee99bb03c2ffdf67072e1dc98f9ef691db700d73f85f57ebd84f5c1711a28d1a50787d6e1b5e726bc50db5a3694f576'

with open('enc.txt') as enc:
    lines = enc.read()
    for i in printable:
        for j in printable:
            for k in printable:
                key2 = i + j + k + '0'*13
                cipher = AES.new(key=key2, mode=AES.MODE_ECB)
                try:
                    pt = cipher.decrypt(ct.decode('hex')).decode('hex')

                except TypeError:
                    continue

                pt_hash = 'md5' + md5(pt).hexdigest()
                if pt_hash in lines:
                    print key2.encode('hex')
                    print pt_hash
                    exit()


# flag = cipher1.decrypt((cipher2.decrypt(enc_flag.decode('hex')).decode('hex'))).decode('hex')
